using Communication;
using Storage.Core;

namespace Storage.Client
{
	public static class StorageClientFactory
	{
		public static StorageClient<T> CreateTcpClient<T>(ISerializer<T> serializer, IDeserializer<T> deserializer)
		{
			var communicator = new ClientCommunicator(settings.EndPoint);
			return new StorageClient<T>(communicator, serializer, deserializer);
		}

		public static StorageClient<T> CreateUdpClient<T>(ISerializer<T> serializer, IDeserializer<T> deserializer)
		{
			var communicator = new UdpClientCommunicator(settings.EndPoint);
			return new StorageClient<T>(communicator, serializer, deserializer);
		}

		private static readonly StorageSettings settings = StorageSettings.GetInstance();
	}
}